﻿using System.ComponentModel.DataAnnotations;
using K9Nano.Application.Dtos;
using K9Nano.GlobalOptions;

namespace K9Nano.Application.Authentication;

public class UserEditDto : IKeyDto
{
    [Required]
    public long Id { get; set; }

    [StringLength(50)]
    [RegularExpression(RegexPatterns.EnDigitUnderline, ErrorMessage = RegexPatterns.EnDigitUnderlineError)]
    public string Username { get; set; }

    [StringLength(50)]
    [RegularExpression(RegexPatterns.ChEnDigitUnderline, ErrorMessage = RegexPatterns.ChEnDigitUnderlineError)]
    public string Name { get; set; }

    [StringLength(50)]
    [RegularExpression(RegexPatterns.Phone, ErrorMessage = "手机号格式不正确")]
    public string? Phone { get; set; }

    [StringLength(100)]
    [RegularExpression(RegexPatterns.Email, ErrorMessage = "Email格式不正确")]
    public string? Email { get; set; }

    [StringLength(100)]
    public string? AvatarUrl { get; set; }

    public bool IsEnabled { get; set; }

    public long[] Roles { get; set; } = [];
}